<%@ page language="java" import="java.util.*,java.text.*"  pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'index.jsp' starting page</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>
  
  <body>
    This is my JSP page. <br>
    <%!
    	boolean isLeapYear(int year){
    		if((year%4==0&&year%100!=0)||year%400==0){
    			return true;
    		}
    		return false;
    	}
     %>
     <%
     	int count=0;
     	for(int year=2000;year<=2013;year++){
     		if(isLeapYear(year)){
     			count++;
     		}
     	}
      %>
    从2000年到2013年共有
 	<%=count %>
 个闰年<br/>
 <%!
 	private static SimpleDateFormat formater=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 	String now(Date date){
 		return formater.format(date);
 	}
  %>
 当前的时间是<%=now(new Date()) %><br/>
 <%
 	int sum=0;
 	for(int i=2;i<=100;i++){
 		int count2=0;
 		int yu=2;
 		while(yu<=i){
 			if(i%yu==0){
 				count2++;
 			}
 			yu++;
 		}
 		if(count2<2){
 			sum+=i;
 		}
 	}
  %>
  100以内所有素数的和是<%=sum %>
 	<form action="showGrade.jsp" method="post">	
			<input type="submit" value="显示所有年级"/>
	</form>
  </body>
</html>
